home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
batuti.arc
/
ANW.C
next >
Wrap
Text File
|
1990-01-11
|
2KB
|
79 lines
#include <dos.h>
#include <mem.h>
#include <alloc.h>
#include <stdio.h>
#include "anw.h"
/*
*
* GetConnectionNumber -- get the current sation number you are logged
* onto.
*
* Richard Connelly,(C) 1989,1990
*
* returns (int station)
*
*/
int GetConnectionNumber(void)
{
struct REGPACK r;
r.r_ax=(0xdc00) ; /* AH=DC get connection number */
intr(0x21,&r) ; /* netware interrupt 21 */
return(r.r_ax & 0xff); /* return the station number */
}
/*
*
* GetConnectInfo -- returns the connection information for
* the station specified in the function.
*
*/
CONNECTINFO GetConnectInfo(int station)
{
struct REGPACK r ;
CONNECTINFO ci ; /* structure for connect info */
OUTPACKET op ;
memset(&ci,0,sizeof(ci)); /* clear the request buffer */
r.r_ds=_DS ; /* set data seg s */
r.r_es=_DS ;
r.r_si=(int)&op ; /* get ready for the call to */
r.r_di=(int)&ci; /* connection info 16h */
r.r_ax=0xe300 ; /* get connection info */
ci.length=sizeof(ci) ;
op.length=sizeof(op) ;
op.function=0x0016 ;
op.station=station ;
intr(0x21,&r) ; /* call the ANW interrupt */
return(ci);
}
/*
*
* GetStationAddress -- Get the NIC's address
*
*/
char *GetStationAddress(void)
{
struct REGPACK r;
char *nic; /* NIC's address */
nic=(char *)malloc(4);
r.r_ax=0xee00; /* get station address function */
r.r_cx=0; /* initialize cx & bx */
r.r_bx=0;
intr(0x21,&r); /* ANW 2.1x function */
if ( r.r_ax==0xee00 && r.r_bx==0 && r.r_cx==0)
r.r_ax=0;
sprintf(nic,"%04x%04x%04x",r.r_cx,r.r_bx,r.r_ax);
return(nic);
}